package com.tron.sync.commons;

import lombok.Data;

public class BaseController {


    public <E> Result<E> buildResult(E data) {
        Result<E> result = new Result<>(data);
        return result;
    }

    public <E> Result<E> buildResult(E data, Integer page, Integer size, Long total) {
        Result<E> result = new Result<>(data,page,size,total);
        return result;
    }


    @Data
    public class Result<D>{
        private D data;
        private Integer state = 200;
        private Integer page;
        private Integer size;
        private Long total;

        public Result(D data) {
            this.data = data;
        }

        public Result(D data, Integer page, Integer size,Long total) {
            this.data = data;
            this.page = page;
            this.size = size;
            this.total = total;

        }

    }

}
